home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / Quadrant scroll 2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.6 KB  |  78 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 3
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6. #define NUM_ITERATIONS    25
  7.  
  8. pascal short QuadrantScroll2(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  9.  
  10. /* 4 regions, splitting the screen into 4 quadrants.  Scroll the screen down in
  11.    the top-left quadrant, right in the top-right, up in the bottom-right,
  12.    left in the bottom-left. */
  13.    
  14. pascal short QuadrantScroll2(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  15. {
  16.     short            x;
  17.     Rect        tlsource, trsource, blsource, brsource;
  18.     Rect        tldest, trdest, bldest, brdest;
  19.     Rect        tlscroll, trscroll, blscroll, brscroll;
  20.     short            cx,cy;
  21.     short            BoxSize, HBoxSize;
  22.     
  23.     BoxSize=theWindowHeight/(NUM_ITERATIONS*2);
  24.     HBoxSize=theWindowWidth/(NUM_ITERATIONS*2);
  25.     
  26.     cx = boundsRect.left + theWindowWidth / 2;
  27.     cy = boundsRect.top + theWindowHeight / 2;
  28.     
  29.     tlscroll=trscroll=blscroll=brscroll=tldest=trdest=bldest=brdest=boundsRect;
  30.     tlscroll.right=trscroll.left=blscroll.right=brscroll.left=
  31.         tldest.right=trdest.left=bldest.right=brdest.left=cx;
  32.     tlscroll.bottom=trscroll.bottom=blscroll.top=brscroll.top=
  33.         tldest.bottom=trdest.bottom=bldest.top=brdest.top=cy;
  34.     tldest.bottom=tldest.top+BoxSize;
  35.     bldest.right=bldest.left+HBoxSize;
  36.     brdest.top=brdest.bottom-BoxSize;
  37.     trdest.left=trdest.right-HBoxSize;
  38.     SetRect(&tlsource, boundsRect.left, cy-BoxSize, cx, cy);
  39.     SetRect(&blsource, cx-HBoxSize, cy, cx, boundsRect.bottom);
  40.     SetRect(&brsource, cx, cy, boundsRect.right, cy+BoxSize);
  41.     SetRect(&trsource, cx, boundsRect.top, cx+HBoxSize, cy);
  42.     
  43.     for (x=0; x<NUM_ITERATIONS; x++)
  44.     {
  45.         StartTiming();
  46.         ScrollTheRect(&blscroll, HBoxSize, 0, 0L);
  47.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  48.                 &blsource, &bldest, 0, 0L);
  49.         blsource.left-=HBoxSize;
  50.         blsource.right-=HBoxSize;
  51.         
  52.         ScrollTheRect(&tlscroll, 0, BoxSize, 0L);
  53.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  54.                 &tlsource, &tldest, 0, 0L);
  55.         tlsource.top-=BoxSize;
  56.         tlsource.bottom-=BoxSize;
  57.         
  58.         ScrollTheRect(&trscroll, -HBoxSize, 0, 0L);
  59.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  60.                 &trsource, &trdest, 0, 0L);
  61.         trsource.left+=HBoxSize;
  62.         trsource.right+=HBoxSize;
  63.         
  64.         ScrollTheRect(&brscroll, 0, -BoxSize, 0L);
  65.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  66.                 &brsource, &brdest, 0, 0L);
  67.         brsource.top+=BoxSize;
  68.         brsource.bottom+=BoxSize;
  69.         
  70.         TimeCorrection(CorrectTime);
  71.     }
  72.     
  73.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  74.         &boundsRect, &boundsRect, 0, 0L);
  75.     
  76.     return 0;
  77. }
  78.